﻿using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using RIA.ServicesLibrary.Web.Models;

namespace RIA.NTiersApp.Views
{
    public partial class CustomerList : Page
    {
        public CustomerList ()
        {
            InitializeComponent ();
            this.Title=Assets.Resources.ApplicationStrings.CustomerPageTitle;
        }

        // Executes when the user navigates to this page.
        protected override void OnNavigatedTo ( NavigationEventArgs e )
        {
        }

        private void NameButton_Click ( object sender, System.Windows.RoutedEventArgs e )
        {
            HyperlinkButton button = sender as HyperlinkButton;
            Customer customer = button.Tag as Customer;
            Uri detailsUri = new Uri ( "CustomerDetails/" + customer.CustomerID.ToString (),UriKind.Relative );
            NavigationService.Navigate ( detailsUri );
        }

        private void btnAdd_Click ( object sender, RoutedEventArgs e )
        {
            Uri detailsUri = new Uri ( "CustomerDetails/" + "-1", UriKind.Relative );
            NavigationService.Navigate ( detailsUri );
        }

    }
}
